package com.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.biz.UserBiz;
import com.entity.Qc_user;


public class UserLonginServlet extends HttpServlet {
	


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();

		Qc_user qc_user = new Qc_user();
		qc_user.setUser_name(request.getParameter("username"));
		qc_user.setUser_pwd(request.getParameter("password"));

		UserBiz uBiz = new UserBiz();
		Qc_user qc_users = uBiz.userLogin(qc_user);
		if (qc_users != null) {
			session.setAttribute("Login", qc_users);
			response.sendRedirect("index.jsp");
		} else {
			response.sendRedirect("login.jsp");
		}
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
